<?php
/* 
 * @package Analyser
 * @author Yves Peeters
 */
include_once('SimpleHtmlDom.php');
/**
 * validates html code
 */
class CodeValidator{

    private $url;

    public function __construct($url){
        $this->url = $url;
    }

    /**
     * checks url with w3c validator
     * @param String $url
     * @return String "valid"|"invalid"
     */
     public function check_w3c() {
        $url ="http://validator.w3.org/check?uri=".urlencode($this->url);// escape url
        $w3c = new simple_html_dom();
        $w3c->load_file($url);
        $valid = $w3c->find('h2');
        $returnvalue=$valid[0]->class;
        $w3c->clear();
        unset($w3c);
        return $returnvalue;
    }

}

?>
